package com.deepgames.mud.action.data;

import com.deepgames.mud.core.InternalCode;


/**
 * Simple data class encapsulating an Action, the unique ID of the object
 * 	causing the action, and a set of pipe-delimited arguments to the action.
 * 
 * @author Zack Hoffmann
 * @version 1.0
 *
 */
public class Command {
	
	private Action action;
	private String sourceID;
	private String args;
	
	public Command(Action action, String sourceID, String args) {
		super();
		this.action = action;
		this.sourceID = sourceID;
		this.args = args;
	}
	public Action getAction() {
		return action;
	}
	public void setAction(Action action) {
		this.action = action;
	}
	public String getSourceID() {
		return sourceID;
	}
	public void setSourceID(String sourceID) {
		this.sourceID = sourceID;
	}
	public String getArgs() {
		return args;
	}
	public void setArgs(String args) {
		this.args = args;
	}
	
	public int execute(ActionContext context) {
		int status = InternalCode.SUCCESS;
		
		status = action.execute(sourceID, args, context);
		
		return status;
	}
}
